import java.util.ArrayList;
import java.util.List;

// 多米诺骨牌
public class dominoes {
    public static String solution(int num, String data) {
        char[] dominoes = data.toCharArray();
        int[] leftForce = new int[num];
        int[] rightForce = new int[num];
        List<Integer> standingDominoes = new ArrayList<>();

        // 计算右边的力
        int force = 0;
        for (int i = 0; i < num; i++) {
            if (dominoes[i] == 'R') {
                force = num;
            } else if (dominoes[i] == 'L') {
                force = 0;
            } else {
                force = Math.max(force - 1, 0);
            }
            rightForce[i] = force;
        }

        // 计算左边的力
        force = 0;
        for (int i = num - 1; i >= 0; i--) {
            if (dominoes[i] == 'L') {
                force = num;
            } else if (dominoes[i] == 'R') {
                force = 0;
            } else {
                force = Math.max(force - 1, 0);
            }
            leftForce[i] = force;
        }

        // 确定最终状态
        for (int i = 0; i < num; i++) {
            if (leftForce[i] == rightForce[i]) {
                standingDominoes.add(i + 1);
            }
        }

        // 构建结果字符串
        StringBuilder result = new StringBuilder();
        result.append(standingDominoes.size());
        if (!standingDominoes.isEmpty()) {
            result.append(':');
            for (int i = 0; i < standingDominoes.size(); i++) {
                result.append(standingDominoes.get(i));
                if (i < standingDominoes.size() - 1) {
                    result.append(',');
                }
            }
        }

        return result.toString();
    }

    public static void main(String[] args) {
        System.out.println(solution(14, ".L.R...LR..L..").equals("4:3,6,13,14"));
        System.out.println(solution(5, "R....").equals("0"));
        System.out.println(solution(1, ".").equals("1:1"));
    }
}